<?php
include_once ($_SERVER['DOCUMENT_ROOT'].'/global.php');
$array = array();
$sql="
SELECT
id,
XingMing,
XueHao,
IdNumber,
CASE
  WHEN
    SUBSTRING(IdNumber, 17, 1) % 2 = 1
  THEN
    '男'
  ELSE
    '女'
END AS XingBie,
BanJi,
Phone,
ReferTime
from
BaoMing
where
IsDelete = 0
order by ReferTime desc
";
$query = $mysqli->query($sql);
while($a = $query->fetch_assoc()) {
  $array[] = $a;
}
echo json_encode($array);
exit;
?>
